package com.example.testdemo.view_state;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.TextView;

import com.example.testdemo.R;

/**
 * Created by 颜 on 05.04.004.
 */

public class ViewStateActivity extends Activity {
    private ViewState viewState;
    private TextView textView;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_view_state);
        viewState = findViewById(R.id.viewState);
        textView = findViewById(R.id.textView);

        viewState.setOnStateListener(new ViewState.OnStateListener() {
            @Override
            public void onState(String str) {
                textView.setText(textView.getText() + "\n" + str);
            }
        });

    }
}
